/* Copyright(C): Leaf Johnson 2009,2010

    This file is part of leaf-lib.

    leaf-lib is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    leaf-lib is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with leaf-lib.  If not, see <http://www.gnu.org/licenses/>.


 * 
 * 
 */


#ifndef PROMOTION_H_INCLUDED
#define PROMOTION_H_INCLUDED
#include <leaf/types.h>
typedef uint8_t PromPort;
typedef uint8_t PromId;
#define PROM_SINGLE  ((PromId)255)

typedef struct{
	PromPort port;
	PromId   id;    /* if id == 0, 则是单独的驱动器，否则处在一主多从模式下 */
}Promotion;

void prom_broadcast(PromPort p, const char *cmd);
#define promBroadcast prom_broadcast
void prom_init(Promotion *p, PromPort port, PromId id);
#define promInit prom_init
void prom_send_command(Promotion *p, const char *cmd);
#define promSendCommand prom_send_command
void prom_speed(Promotion *p, speed_t speed);
#define promSpeed prom_speed
void prom_votage(Promotion *p, int16_t v);
#define promVotage prom_votage
void prom_current(Promotion *p, int16_t c);
#define promCurrent prom_current
void prom_move(Promotion *p, dist_t dist);
#define promMove prom_move
void prom_position(Promotion *p, dist_t dist);
#define promPosition prom_position

void prom_change_baud(PromPort p, uint32_t baudrate);
#define promChangeBaud prom_change_baud
void prom_change_id(Promotion *p, PromId id);
#define promChangeId prom_change_id
#endif  /* PROMOTION_H_INCLUDED */
